package com.newcoretech.platform_service.scanner.thread;///

import android.content.Context;


import com.newcoretech.platform_service.scanner.QRCodeDecoder;

import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;

/// * @ProjectName: scanner
/// * @Author: qifanxin
/// * @CreateDate: 2022/3/22 2:08 下午
/// * Copyright: ©2022 NEW CORE Technology Co. Ltd. All rights reserved.
/// * @Description: 文件说明
///
public class QRCodeReadThread extends Thread {

    private CopyOnWriteArrayList<String> resList;

    private String path;

    private CountDownLatch mCountDownLatch;

    private Context mContext;

    public void setData(CountDownLatch countDownLatch, CopyOnWriteArrayList<String> resList, String path, Context context) {
        this.mCountDownLatch = countDownLatch;
        this.resList = resList;
        this.path = path;
        this.mContext = context;
    }

    @Override
    public void run() {
        super.run();
        try {
            resList.add(QRCodeDecoder.syncDecodeQRCode(mContext, path));
        } catch (Exception e) {

        } finally {
            mCountDownLatch.countDown();
        }
    }
}
